package com.xiang.api;

import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@ComponentScan(basePackages = { "com.xiang.sql", "com.xiang.api", "com.xiang", "com.xiang.sql.StaticMapper" })
@MapperScan(basePackages = { "com.xiang.sql.mapper", "com.xiang.api.mapper" })
@SpringBootApplication
@EnableScheduling
public class ApiApplication implements WebMvcConfigurer {

  public static void main(String[] args) throws IOException {
    System.setOut(new PrintStream(System.out, true, StandardCharsets.UTF_8));
    ConfigurableApplicationContext applicationContext = SpringApplication.run(ApiApplication.class, args);
    // SpringApplication.run(Util.class, args);
    Util.setApplicationContext(applicationContext);
  }

}
